﻿using UnityEngine;
using System.Collections;
using System;
using DG.Tweening;
using YoUI.Core;

namespace YoUI.Core.UIAnima
{
    /// <summary>
    /// UI位置移动过度
    /// </summary>
    [AddComponentMenu("YoUI/Anima/DoTweenPosition")]
    public class YoTweenPosition : YoTweenBase
    {
        public Vector2 from;
        public Vector2 to;

        protected override void Start()
        {
            from = rt.anchoredPosition;
        }

        [ContextMenu("Set To Value")]
        public void SetToValue ()
        {
            from = transform.GetComponent<RectTransform>().anchoredPosition;
        }

        public override Tweener Anima()
        {
            return rt.DOAnchorPos(to, duration);
        }
    }
}
